Ranking and Unranking Left Szilard Languages
نویسنده
چکیده
We give efficient ranking and unranking algorithms for left Szilard languages of context-free grammars. If O(n2) time and space preprocessing is allowed then each ranking operation is possible in linear time. Unranking takes time O(n log n). These algorithms imply similar algorithms for context-free languages generated by arbitrary unambiguous context-free grammars.
منابع مشابه
Ranking and Unranking of Lexicographically Ordered Words: An Average-Case Analysis
We consider all words of length n of a formal language. If these words are arranged according to the lexicographical order, then ranking means to determine the position of a word of the language. Unranking is the inverse operation of ranking. For a given formal language we compute the average length of the minimal preex of a word to be read to determine its position, if the word is read from le...
متن کاملRanking and Unranking of a Generalized Dyck Language
Given two disjoint alphabets T and T ] and a relation R T T ] , the generalized Dyck language D R over T T ] consists of all words w 2 (T T ]) ? which are equivalent to the empty word " under the congruence deened by x y " mod for all (x; y) 2 R. If the Dyck words are arranged according to the lexicographical order, then ranking means to determine the rank, i. e. the position, of a Dyck word. U...
متن کاملRanking Catamorphisms and Unranking Anamorphisms on Hereditarily Finite Datatypes
Using specializations of unfold and fold on a generic tree data type we derive unranking and ranking functions providing natural number encodings for various Hereditarily Finite datatypes. In this context, we interpret unranking operations as instances of a generic anamorphism and ranking operations as instances of the corresponding catamorphism. Starting with Ackerman’s Encoding from Hereditar...
متن کاملA Note on the Emptiness of Intersection Problem for Left Szilard Languages
As left Szilard languages form a subclass of simple deterministic languages and even a subclass of super-deterministic languages, we know that their equivalence problem is decidable. In this note we show that their emptiness of intersection problem is undecidable. The proof follows the lines of the correponding proof for simple deterministic languages, but some technical tricks are needed. This...
متن کاملRanking and Unranking of Hereditarily Finite Functions and Permutations
Prolog’s ability to return multiple answers on backtracking provides an elegant mechanism to derive reversible encodings of combinatorial objects as Natural Numbers i.e. ranking and unranking functions. Starting from a generalization of Ackerman’s encoding of Hereditarily Finite Sets with Urelements and a novel tupling/untupling operation, we derive encodings for Finite Functions and use them a...
متن کامل